export default {
    tatal(state){
       return  state.cart.reduce((result,item)=>{
           result += item.count * item.price
            return result
        },0)
    // const checkedItems = state.cart.filter(item => {
    //     return state.checkedCartItems.some(id => item.id === id);
    //     // return this.checkedCartItems.includes(item.id);
    //   });
    //   return checkedItems.reduce((total, item) => {
    //     total += item.count * item.price;
    //     return total
    //   }, 0);
    },
    isAllChecked(state){
        return state.cart.every(item=>item.isChecked===true)
    },
    tocont(state){  
        return  state.cart.reduce((result,item)=>{
            result += item.count 
             return result
         },0)
    },
    tatalChecked(state){
        return  state.cart.reduce((result,item)=>{
            if(item.isChecked===true){
                result += item.count * item.price
            }
         
             return result
         },0)
    }
}